#!/bin/bash


#环境配置
chmod 755 -R  /var/spool/cron/
echo " zabbix  ALL=(ALL)      NOPASSWD:ALL"   >> /etc/sudoers
yum -y install net-tools;chmod 644 /var/log/secure
chmod 644 /etc/ssh/sshd_config

#优化
A=`cat -n  /etc/zabbix/zabbix_agentd.conf  | grep StartAgents=   | awk '{print $1}'`
B=`cat -n  /etc/zabbix/zabbix_agentd.conf  | grep RefreshActiveChecks=   | awk '{print $1}'`
C=`cat -n  /etc/zabbix/zabbix_agentd.conf  | grep BufferSize=  | awk '{print $1}'`
D=`cat -n  /etc/zabbix/zabbix_agentd.conf  | grep Timeout=  | awk '{print $1}'`

sed -i  ''"$A"'c StartAgents=1'   /etc/zabbix/zabbix_agentd.conf
sed -i   ''"$B"'c RefreshActiveChecks=1800'  /etc/zabbix/zabbix_agentd.conf
sed -i   ''"$C"'c BufferSize=200'   /etc/zabbix/zabbix_agentd.conf
sed -i   ''"$D"'c Timeout=30'    /etc/zabbix/zabbix_agentd.conf

#启动zabbix
clear
systemctl enable zabbix-agent
systemctl start  zabbix-agent
systemctl restart  zabbix-agent
clear
ss -ntl | grep 10050
sleep 2
 


